package com.util;

import java.lang.reflect.Type;
import java.util.Iterator;
import java.util.LinkedList;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jsonBean.GroceryDetailBean;
import com.jsonBean.GroceryGroupBean;

public class JsonUtil {

	public static GroceryGroupBean pJson_List(String JsonStr) {
		Gson gson = new Gson();
		try {
			GroceryGroupBean groupBean = (GroceryGroupBean) gson.fromJson(
					JsonStr, new TypeToken<GroceryGroupBean>() {
					}.getType());
			return groupBean;
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return null;
		}
	}
	public static GroceryDetailBean pJson_Detail(String JsonStr) {
		Gson gson = new Gson();
		try {
			GroceryDetailBean groupBean = (GroceryDetailBean) gson.fromJson(
					JsonStr, new TypeToken<GroceryDetailBean>() {
					}.getType());
			return groupBean;
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return null;
		}
	}
}
